<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 编写一个函数 ，输入一个数字，返还数字的长度 -->

    <!-- <script>
      function fn(num) {
        var res = 0;
        for (var i = num; i != 0; ) {
          if (i != 0) {
            i = parseInt(i / 10);
            res++;
          }
        }
        return res;
      }
      console.log(fn(-2132123456));
    </script> -->
    <script>
      function fn(num) {
        var res = num + "";
        return res.length;
      }
      console.log(fn(100));
    </script>
  </body>
</html>
